package com.lzq.model.singleton;

/**
 * @author : modify
 * @version : v1.0
 * @description :
 * @createTime : 2022/11/13 16:54
 * @updateUser : modify
 * @updateTime : 2022/11/13 16:54
 * @updateRemark : 懒汉式 静态内部类
 */
public class LazyStyleClass {
    private LazyStyleClass() {

    }

    private static class LazyStyleClassWithin {
        private static final LazyStyleClass LAZY_STYLE_CLASS = new LazyStyleClass();
    }

    public static LazyStyleClass getInstance() {
        return LazyStyleClassWithin.LAZY_STYLE_CLASS;
    }
}

class LazyStyleClassTest {
    public static void main(String[] args) {
        LazyStyleClass instance = LazyStyleClass.getInstance();
        LazyStyleClass instance1 = LazyStyleClass.getInstance();
        System.out.println(instance == instance1);
    }
}